package com.springBootStudy.annotation.config;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @ program: elasticSearch_springBoot_study
 * @ description:
 * @ author: Mr.Zhongsf
 * @ create: 2021-03-10 09:52
 **/
public class TestConigAnnotation {
    public static void main(String[] args) {

        //如果完全使用配置类的方式去做,那么我们只能通过AnnotationConfig 上下文来获取容器,通过配置class对象来加载
        ApplicationContext context = new AnnotationConfigApplicationContext(MyUserConfig.class);
        UserMy user = context.getBean("getUserMy", UserMy.class);
//        UserMy user = context.getBean("userMy", UserMy.class);
        System.out.println(user.getName());

        UserMy user2 = context.getBean("getUserMy2", UserMy.class);
        System.out.println(user2.getName());
    }

}
